package com.fiume.user.web;

import com.fiume.user.pojo.User;
import com.fiume.user.service.UserService;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 * Description:
 * </p>
 *
 * @author fiume
 * @version v1.0.0
 * @create 2021-01-17 19:41
 * @see com.fiume.user.web
 */
@RestController
@RequestMapping("user")
public class UserController {

    @Resource
    private UserService userService;

    @RequestMapping("/{id}")
    public User findById(@PathVariable("id") Long id, @RequestHeader(value = "NAME", required = false) String name) {
        System.out.println("name = " + name);
        return userService.findById(id);
    }

}
